import 'package:dailyEn/kouyu_list.dart';
import 'package:dailyEn/news.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:dailyEn/global.dart';
import 'dart:ui';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Daily口语',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentIndex = 0;
  List listTabs = [
    KouYuListPage(),
    NewsListPage(),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          'Daily口语',
          style: TextStyle(
            color: Global.fontColor,
            fontSize: 13,
            fontWeight: FontWeight.bold,
          ),
        ),
        backgroundColor: Global.backgroundColor,
        brightness: Brightness.light,
        elevation: 0,
      ),
      body: this.listTabs[this.currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: this.currentIndex,
        iconSize: 30.0,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          setState(() {
            this.currentIndex = index;
          });
        },
        selectedItemColor: Global.fontColor,
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.calendar_view_day),
            title: Text('口语练习'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.list_alt),
            title: Text('双语新闻'),
          ),
        ],
      ),
    );
  }
}
